package com.levy.contronller.javase.designModel.decorator;

/**
 * 装饰器模式
 * 属于结构型模式
 * 允许向一个现有的对象添加新的功能，同时又不改变其结构
 */
public class MainClass {
    //使用 RedShapeDecorator 来装饰 Shape 对象
    public static void main(String[] args) {

        Shape circle = new Circle();
        ShapeDecorator redCircle = new RedShapeDecorator(new Circle());
        ShapeDecorator redRectangle = new RedShapeDecorator(new Rectangle());
        //Shape redCircle = new RedShapeDecorator(new Circle());
        //Shape redRectangle = new RedShapeDecorator(new Rectangle());
        System.out.println("Circle with normal border");
        circle.draw();

        System.out.println("\nCircle of red border");
        redCircle.draw();

        System.out.println("\nRectangle of red border");
        redRectangle.draw();
    }
}
